﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using LogicLevel;

namespace WebLevel
{
    public partial class Validation : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            if (Request.QueryString["hash"] == null)
            {
                Response.Write("<script>alert('验证有误！窗口即将关闭。');window.close();</script>");
                return;
            }
            else
            {
                String temp = Request.QueryString["hash"].ToString();
                int id = Convert.ToInt32(temp.Substring(16, temp.Length - 16));
                String verification = temp.ToString().Substring(0, 16);
                int result = UserMethod.userVerify(id, verification);
                if (result == 1)
                    Response.Write("<script>alert('验证成功，请到起始界面登录！');window.close();</script>");
                else if (result == -1)
                    Response.Write("<script>alert('验证码失效，您已经验证过了！');window.close();</script>");
                else
                    Response.Write("<script>alert('验证有误！窗口即将关闭。');window.close();</script>");

            }
        }
    }
}